﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using Microsoft.Win32;

namespace EMRNotes
{

    
    public partial class EMRAddRecordForm : Form
    {
        private FileInfo[] templates;

        public EMRAddRecordForm()
        {
            InitializeComponent();

            DirectoryInfo diSource = new DirectoryInfo((string)Registry.GetValue("HKEY_LOCAL_MACHINE\\Software\\MCD-soft\\OneNoteEMR", "TemplatesFolderPath", "C:\\Templates\\"));

            templates = diSource.GetFiles();
        }

        public int RecordType { get; set; }
        public string TemplateFile { get; set; }

        private void EMRAddRecordForm_Load(object sender, EventArgs e)
        {
            cbTemplates.Items.Clear();
            cbTemplates.Items.Add(Resource1.NotUsed);
            
            foreach (FileInfo file in templates)
            {
                cbTemplates.Items.Add(file.Name);

            }
            cbTemplates.SelectedIndex = 0;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
                RecordType = 1;
            else if (radioButton2.Checked)
                RecordType = 2;
            else if (radioButton3.Checked)
                RecordType = 3;
            else if (radioButton4.Checked)
                RecordType = 4;

            TemplateFile = cbTemplates.Text;

        }

        private void cbTemplates_SelectedIndexChanged(object sender, EventArgs e)
        {
            //if (cbTemplates.Text != null && cbTemplates.Text != String.Empty)
            //    btnOK.Enabled = true;
            //else
            //    btnOK.Enabled = false;
        }
    }
}
